param(
	[Parameter(Mandatory=$false)]                             
	[string]$inputFile="inputlist.txt"                       # the input file to store vdi and fid list
)
$start=get-date
Try {
    $this_path = Split-Path -Parent ($MyInvocation.MyCommand.Definition) -ea 1
} Catch {
    $this_path = [System.IO.Path]::GetDirectoryName([System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName)
} Finally { }
$function_file="$this_path\functions.ps1"
If( test-path $function_file -ea 0){
	. $function_file # import functions to powershell from functions.ps1
}else{
    write-error "Not found $function_file" ; return
}
If(!(Check-AdminRight)){ Popup-Message "Admin right is required to run this script!";return}
If( $inputFile -notlike "*\*"){
    $inputFile="$this_path\$inputFile"
}
$inputlist = Get-Inputlist $inputFile
# <-------------------------------------- run every main script under this directory's folders
dir $this_path|?{$_.PsIsContainer}|%{iex "$($_.Fullname)\main.ps1 -inputFile $inputFile -inputFileSaved -functionInvoked"}
#<-------------------------------------- combine csv files to one total csv file.
iex "$this_path\generate_comparison_report.ps1"
$run_mins=[math]::Round(((get-date)-$start).totalminutes)
Write-Host -ForegroundColor Yellow "The script master.ps1 completed successfully in $run_mins mins."
